package com.woniuxy.dao;

import com.woniuxy.model.ProjectUrl;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author 马世亮
 * @since 2022-02-15
 */
public interface ProjectUrlDao extends BaseMapper<ProjectUrl> {

    @Select("SELECT DISTINCT pu.url_value url_value FROM account_role ar\n" +
            "JOIN role_url ru ON ar.role_id=ru.role_id\n" +
            "JOIN project_url pu ON pu.url_id=ru.url_id\n" +
            "WHERE ar.account_id=#{accountId}\n" +
            "UNION\n" +
            "SELECT url_value FROM project_url WHERE url_status=0")
    public List<String> getUrlByAccountId(Integer accountId);
}
